﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditMediaFilePopup.aspx.cs" Inherits="Cms.Web.UI.Admin.TinyMCEIntegration.EditMediaFilePopup" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <base id="baseTag" runat="server" />
    <link rel="stylesheet" type="text/css" href="Admin/Css/Buttons.css" />
    <link rel="stylesheet" type="text/css" href="Admin/Css/ErrorBox.css" />
    <link rel="stylesheet" type="text/css" href="Admin/Css/Dialogs.css" />
    <link rel="stylesheet" type="text/css" href="Admin/Css/PopupMenu.css" />
    <link rel="Stylesheet" type="text/css" href="Admin/Css/EditMenu.css" />
    <script language="javascript" src="Admin/Js/CmsLib.js"></script>
    <script language="javascript" src="Admin/Js/Ajax.js"></script>
    <script language="javascript" src="Admin/Js/Dialogs.js"></script>
    <script language="javascript" src="Admin/Js/Lists.js"></script>
    <script language="javascript" type="text/javascript" src="Admin/Js/Edit.js"></script>
    <script type="text/javascript" src="Admin/tiny_mce/tiny_mce_popup.js"></script>
    <script type="text/javascript">
        //<![CDATA[
        var FileBrowserDialogue;

        function initPopup() {
            FileBrowserDialogue = {
                init: function() {
                    // Here goes your code for setting your custom things onLoad.
                },
                submit: function() {
                }
            }
            tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
        }

        function showUploadWindow() {
            var win = tinyMCEPopup.getWindowArg("window");
            tinyMCE.activeEditor.windowManager.open({
                file: "Admin/TinyMCEIntegration/UploadPopup.aspx?v=1",
                title: "",
                width: 540,  // Your dimensions may differ - toy around with them!
                height: 500,
                resizable: "no",
                inline: "yes", // This parameter only has an effect if you use the inlinepopups plugin!
                close_previous: "no"
            }, {
                window: win
            });
            parent.document.getElementById("mceModalBlocker").style.zIndex += 1;
            return false;
        }

        function uploadCompleteCallback() {
            __doPostBack('lbUpdate','');
        }

        function updatePanels(tab) {
            var pnlProperties = document.getElementById("pnlProperties");
            var pnlDescription = document.getElementById("pnlDescription");
            pnlProperties.style.display = "none";
            pnlDescription.style.display = "none";
            switch (tab) {
                case "properties":
                    pnlProperties.style.display = "";
                    break;
                case "description":
                    pnlDescription.style.display = "";
                    break;
            }
        }

        var txtFilename;
        var ddlFolders;
        var txtSortKey;
        var txtTitle;
        var txtDescription;

        var originalFilename;
        var originalFolderID;
        var originalSortKey;
        var originalCategories;
        var originalTitle;
        var originalSelectedCategories;
        var originalSelectedAllowedAdminGroups;
        var originalSelectedDeniedAdminGroups;
        var originalSelectedRequiredUserGroups;

        function init() {
            txtFilename = document.getElementById("txtFilename");
            ddlFolders = document.getElementById("ddlFolders");
            txtSortKey = document.getElementById("txtSortKey");
            txtTitle = document.getElementById("txtTitle");
            txtDescription = document.getElementById("txtDescription");
            originalFilename = txtFilename.value;
            originalFolderID = ddlFolders.options[ddlFolders.selectedIndex].value;
            originalSortKey = txtSortKey.value;
            originalSelectedCategories = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdCategories");
            originalTitle = txtTitle.value;
            originalDescription = txtDescription.value;
            originalSelectedAllowedAdminGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdAllowedAdminGroups");
            originalSelectedDeniedAdminGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdDeniedAdminGroups");
            originalSelectedRequiredUserGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdRequiredUserGroups");
        }

        function isDirty() {
            ddlFolders = document.getElementById("ddlFolders");
            var value = originalFilename == "" ||
	                    originalFilename != txtFilename.value ||
	                    originalFolderID != ddlFolders.options[ddlFolders.selectedIndex].value ||
	                    originalTitle != txtTitle.value ||
	                    originalDescription != txtDescription.value ||
	                    originalSortKey != txtSortKey.value ||
	                    originalSelectedCategories != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdCategories") ||
	                    originalSelectedAllowedAdminGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdAllowedAdminGroups") ||
	                    originalSelectedDeniedAdminGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdDeniedAdminGroups") ||
	                    originalSelectedRequiredUserGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdRequiredUserGroups");
            document.getElementById("hidIsDirty").value = value;
            return value;
        }
        //]]>
    </script>
    <style type="text/css">
        body { background-color: #f0f0ee; }
        input { border: 1px solid #919b9c; padding: 2px; }
        input[type="checkbox"] { border: none; }
        img { margin: 0px; border: 0px; }
        a, a:hover, a.hover { color: #444455; }
        .inheritedCategory { color: #aaaaaa; }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" EnablePageMethods="true">
        <Services>
            <asp:ServiceReference Path="~/Authentication.asmx" InlineScript="false" /> 
        </Services>
    </asp:ScriptManager>
    <div style="text-align: right;">
        <asp:LinkButton ID="lbSaveFile" runat="server" OnClick="lbSaveFile_Click" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/disk.png" alt="" /><span><cms:LocalizedLiteral ID="llSaveFile" runat="server" /></span></span></span></asp:LinkButton>
        <asp:hyperlink ID="hlCancel" runat="server" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/delete.png" alt="" /><span><cms:LocalizedLiteral ID="llCancel" runat="server" /></span></span></span></asp:hyperlink>
    </div>

    <asp:UpdatePanel ID="upnlAddValidation" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlError" runat="server">
                <div id="errorBoxTopOuterContainer" style="margin-top: 6px;">
                    <div id="errorBoxTopInnerContainer">
                        <div id="errorBoxTop">
                            <div id="errorBoxTopBg">&nbsp;</div>
                            <div id="errorBoxTopLeftCorner">&nbsp;</div>
                            <div id="errorBoxTopRightCorner">&nbsp;</div>
                        </div>
                    </div>
                </div>
                <div id="errorBox">
                    <div id="errorBoxLeftBg">&nbsp;</div>
                    <div id="errorBoxRightBg">&nbsp;</div>
                    <div id="errorBoxContent">
                            <asp:ValidationSummary ID="vs" runat="server" EnableClientScript="true" />
                    </div>
                </div>
                <div id="errorBoxBottom">
                    <div id="errorBoxBottomBg">&nbsp;</div>
                    <div id="errorBoxBottomLeftCorner">&nbsp;</div>
                    <div id="errorBoxBottomRightCorner">&nbsp;</div>
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div id="mainBoxTopOuterContainer" runat="server">
    <asp:UpdatePanel ID="upnlTabs" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <cms:AdminTabStrip ID="tabStrip" runat="server" SelectedValue="properties" OnChange="tabStrip_Click">
                <cms:AdminTabItem ID="tiProperties" runat="server" value="properties" EnabledImage="Admin/Img/icons/page_white_gear.png"><cms:LocalizedLiteral ID="llPropertiesTab" runat="server" /></cms:AdminTabItem>
                <cms:AdminTabItem ID="tiDescription" runat="server" value="description" EnabledImage="Admin/Img/icons/page_white_edit.png"><cms:LocalizedLiteral ID="llDescriptionTab" runat="server" /></cms:AdminTabItem>
            </cms:AdminTabStrip>
            <input type="hidden" id="hidIsDirty" runat="server" />
            <input type="hidden" id="hidSave" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
    </div>
    <div id="listContainer" style="margin: 0px; margin-top: 6px; border: 1px solid #919b9c; padding: 10px; background-color: #fff;">
    <asp:Panel ID="pnlProperties" runat="server" CssClass="pnlTab">
        <asp:UpdatePanel ID="upnlProperties" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <table class="editForm">
                    <tr>
                        <td><cms:LocalizedLiteral ID="llName" runat="server" />:</td>
                        <td><asp:TextBox ID="txtFilename" runat="server" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llFolder" runat="server" />:</td>
                        <td><ilib:iDropDownList ID="ddlFolders" runat="server" OnSelectedIndexChanged="ddlFolders_IndexChanged" AutoPostBack="true" /></td>
                    </tr>
                </table>
                <div class="adminPageSectionDivider"></div>
                <div style="font-size:16px; margin-top: 20px; padding-left: 2px;"><cms:LocalizedLiteral id="llAdvancedSettingsHeader" runat="server" /></div>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llCategoriesHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trCategories" runat="server" valign="top">
                        <td><cms:LocalizedLiteral ID="llCategories" runat="server" />:</td>
                        <td id="tdCategories"><cms:CategorySelector id="csCategories" runat="server" ShowTabOverlay="true" OffsetLeft="-2" OffsetTop="1" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llSortKey" runat="server" />:</td>
                        <td><asp:TextBox ID="txtSortKey" runat="server" MaxLength="255" Width="400" /></td>
                    </tr>
                </table>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llUserAccessControlHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trRequiredUserGroups" runat="server" valign="top">
                        <td><cms:LocalizedLiteral ID="llRequiredUserGroups" runat="server" />:</td>
                        <td id="tdRequiredUserGroups"><cms:UserGroupSelector id="gsRequiredUserGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                </table>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llAdministratorAccessControlHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trAllowedAdministratorGroups" runat="server" valign="top">
                        <td><cms:LocalizedLiteral ID="llAllowedAdministratorGroups" runat="server" />:</td>
                        <td id="tdAllowedAdminGroups"><cms:AdministratorGroupSelector id="gsAllowedAdministratorGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                    <tr id="trDeniedAdministratorGroups" runat="server" valign="top">
                        <td><cms:LocalizedLiteral ID="llDeniedAdministratorGroups" runat="server" />:</td>
                        <td id="tdDeniedAdminGroups"><cms:AdministratorGroupSelector id="gsDeniedAdministratorGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="pnlTabOverlay"></div>
    </asp:Panel>
    <asp:Panel ID="pnlDescription" runat="server" CssClass="pnlTab">
        <asp:UpdatePanel ID="upnlDescription" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <table class="editForm">
                    <tr>
                        <td><cms:LocalizedLiteral ID="llLocale" runat="server" />:</td>
                        <td><asp:DropDownList ID="ddlLocales" runat="server" OnSelectedIndexChanged="ddlLocales_IndexChanged" AutoPostBack="true" /></td>
                    </tr>
                </table>
                <div class="adminPageSectionDivider"></div>
                <table class="editForm">
                    <tr>
                        <td><cms:LocalizedLiteral ID="llTitle" runat="server" />:</td>
                        <td><asp:TextBox ID="txtTitle" runat="server" MaxLength="255" Width="600" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llDescription" runat="server" />:</td>
                        <td><asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Width="600" Rows="5" /></td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="pnlTabOverlay"></div>
    </asp:Panel>
    </div>
    <script language="javascript" type="text/javascript">
        //<![CDATA[
        iLib.Dom.AddListener(window, "load", init);
        cms.Ajax.Init();
        cms.Ajax.AddEndRequestHandler(cms.Edit.HideTabOverlays);
        //]]>
    </script>
    </form>
</body>
</html>
